/**
 * Filename JudgeModelOne.java 2021年06月24日
 * Copyright © Ehome Co.Ltd. All Rgiths Reserved.
 *
 * @author wuyingchao
 */
package com.ehome.poct.core.service.report;

import com.ehome.poct.core.api.constant.enums.DiseaseRiskLevel;
import com.ehome.poct.core.api.dto.check.gold.TestReportDiseaseConfigDTO;
import com.ehome.poct.core.api.vo.report.DiseaseDtlVO;
import com.ehome.poct.core.service.mapping.H5ReportMapping;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * 通过crp值判定（只判断最小值）
 *
 * @author wyc
 * @date 2021/06/24 14:47
 **/
@Component
@AllArgsConstructor
public class CrpJudgeTwo implements DiseaseJudge {
    private final H5ReportMapping reportMapping;

    @Override
    public DiseaseDtlVO judge(BigDecimal crp, BigDecimal saa, TestReportDiseaseConfigDTO disease) {
        if (crp.compareTo(disease.getValue1Min()) <= 0) {
            return reportMapping.to(disease, DiseaseRiskLevel.LOW);
        } else {
            return reportMapping.to(disease, DiseaseRiskLevel.HIGH);
        }
    }
}